#ifndef __MONKEY_SLIDE_CollisionTree__H__
#define __MONKEY_SLIDE_CollisionTree__H__

#include "cocos2d.h"
#include "Config.h"
#include "Model/Tree.h"
#include "Model/Monkey.h"
#include "Model/Cloud.h"
USING_NS_CC;

class CollisionTree : public CCComponent
{
	private:
		virtual void update(float delta); // kiem tra tinh trang con chim va thuc hien hanh dong tuong ung....
		CCAction* curAction;//luu hanh dong hien tai de "stop" truoc khi thuc hien hanh dong ke tiep..
		Monkey* mMonkey;
		Cloud* mCloud;
		CCSize visibleSize;
		int mMovedLeft;
		int mMovedRight;

		float xDistance;

	public:

		Tree * parent;

		CollisionTree(Monkey *monkey,Cloud *cloud);
		bool fIsCollision(CCNode * sp1 , CCArmature * sp2 , int minSize); // Kiem tra va cham
		bool fIsCollisionOfBody(CCRect sp1 , CCRect sp2);

		void fMoveUp(); // Cay chay nguoc len tren
		void fMoveLeft(); // Cay chay sang trai
		void fMoveRight(); // Cay chay sang phai

		void fMoveUpCallback(CCObject* object);
		void fJumpCallback(CCObject * object);
		void actionStop(); // Stop all action

};
#endif